#include "macro_initialize.h"
#include <cmsis_os2.h>

int count1 = 0;
int count2 = 0;
int count3 = 0;

void init(void *argument)
{
	rt_components_init();
}

int main()
{
	//板级初始化
	rt_components_board_init();
	
	//系统级初始化
	osThreadNew(init,NULL,NULL);
	osKernelStart();
	
	for(;;)
	{
	}
}

void t(void *argument)
{
	int *count = (int *)argument;
	for(;;)
	{
		count[0]++;
		osDelay(1000);
	}
}

int count1_init()
{
	count1 = 100;
	return 0;
}
INIT_BOARD_EXPORT(count1_init);

int count2_init()
{
	count2 = 200;
	return 0;
}
INIT_DEVICE_EXPORT(count2_init);

int count3_init()
{
	count3 = 300;
	return 0;
}
INIT_ENV_EXPORT(count3_init);

int t1_init()
{
	osThreadNew(t,&count1,NULL);
	return 0;
}
INIT_APP_EXPORT(t1_init);

int t2_init()
{
	osThreadNew(t,&count2,NULL);
	return 0;
}
INIT_APP_EXPORT(t2_init);

int t3_init()
{
	osThreadNew(t,&count3,NULL);
	return 0;
}
INIT_APP_EXPORT(t3_init);
